<?php
require("../core.php");
$_GET['t'] = 1;

$st = 0;
if(isset($_GET['s']) && intval($_GET['s']) > 0 && intval($_GET['s']) < 8) 
{
	$st = intval($_GET['s']);
}
$list = getJson("php/".$st.".json");
include("../include/head.php");
?>
<div class='con'>
<div class='sleft'>
<?php
foreach($list as $v)
{
	echo "<a href='study.php?s=",$st,"&f=",$v[0],"'>",$v[1],"</a><br/>";
}
?>
</div>
<?php 
$f = $list[0][0];
if(isset($_GET['f']) && file_exists(ROOT."/php/".$_GET['f'].".json")) $f = $_GET['f'];
include($f.".json");
?>
<div style="clear:both;"></div>
</div>
<style type="text/css">
#codeMark{
    position: fixed;
    top: 0;
    width: 100%;
    bottom: 0;
    z-index: 1998;
    background: rgba(0,0,0,0.5);
	display:none;
}
#codeMain{
	position:fixed;
	z-index:1999;
	top:10%;
	left:10%;
	background:white;
	display:none;
}
#codeMain .left{
	width:49%;
    height: 100%;
	background-color: #14191e;
	float: left;
}
#codeMain .left #codeEditor{
	width:100%;
	font-size:16px;
	border:0;  
    background-color:transparent;
	color:#fff;
}
#codeMain .right{
	width:50%;
	height: 100%;
	float: right;
}
#codeMain .right iframe{
	height: 100%;
}
#codeMain #close{
    position: absolute;
    right: -20px;
    top: -20px;
    height: 50px;
    width: 50px;
	background:url(/img/closeCode.png) no-repeat;
    background-size: 100%;
	cursor:pointer;
}
</style>
<div id="codeMark"></div>
<div id="codeMain">
<div class="left"><form action="http://demo.php.cn/compile.php" method="post" target="runphp">
	<textarea id="codeEditor" name="code">&lt;?php echo &quot;hello&quot;; ?&gt;</textarea><br/>
	<hidden name="language" value="3" />
	<input type="submit" />
</form></div>
<div class="right"><iframe style="width:100%" frameborder="0" name="runphp"></iframe></div>
<div id="close"></div>
</div>
<script type="text/javascript" src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
$('.codebtn').click(function(){
	$('#codeMark').show();
	$('#codeMain').show().css({width:$(window).width()*0.8,height:$(window).height()*0.8});
	$('#codeEditor').css({height:$('#codeMain').height()-50});
	var code = $(this).closest('.example').find('.example_code pre').html();
	code = code.replace(/&lt;/g,'<');
	code = code.replace(/&gt;/g,'>');
	code = code.replace(/&nbsp;/g,' ');
	$('#codeEditor').val(code);
	$('#codeMain form').submit();
	return false;
});
$('#codeMain #close,#codeMark').click(function(){
	$('#codeMark').hide();
	$('#codeMain').hide();
});
</script>
<?php
include("../include/foot.php");